import React from 'react'
import { Tabs } from 'antd'

const TabPane = Tabs.TabPane;

class Header extends React.Component {
	constructor(props) {
		super(props)

		this.state = {

		}
	}

	callback = key => {
		const params = {
			operatingState: Number(key),
			operatingType: 0
		}
		const { showMenu, onSearch } = this.props
		showMenu(key)
		onSearch(params)
	}
	componentDidMount() {
		const { menu,pagination } = this.props
		// console.log(pagination)
		const params = {
			operatingState: menu,
			operatingType: 0,
			page:pagination.current,
		}
		const { onSearch } = this.props
		onSearch(params)
	}

	render() {
		const { menu } = this.props
		const keys = 1
		const permissions = JSON.parse(sessionStorage.getItem("permissions"))

		return (
			<div>
				<Tabs defaultActiveKey={menu} onChange={this.callback}>
					{permissions.indexOf("file:fileComponent:apply") != -1?
					<TabPane tab="归档申请" key="0">

					</TabPane>
					:""}

					{permissions.indexOf("file:fileComponent:apply") != -1?
					<TabPane tab="我的申请" key="2">

					</TabPane>
					:""}

					{permissions.indexOf("file:fileComponent:checked") != -1?
					<TabPane tab="待审批" key="1">

					</TabPane>
					:""}
					{permissions.indexOf("file:fileComponent:checked") != -1?
					<TabPane tab="已审批" key="3">

					</TabPane>
					:""}		
				</Tabs>
			</div>
		)
	}
}

export default Header